home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / lzrtpu.com / LZRTPU.DOC < prev    next >
Encoding:
Text File  |  1990-10-19  |  6.2 KB  |  153 lines

  1. The LASERPRT.PAS file produces a unit which is used for
  2. printing reports with a HP LaserJet or compatible printer.
  3. Most of the commonly used formatting commands have been
  4. provided as functions.  Each function returns a string
  5. containing the appropriate HP PCL control codes.  It is
  6. anticipated that the function calls would be made within a
  7. "WRITE(lst," or a "WRITELN(lst," statement.
  8.  
  9. One of the most difficult problems I had in trying to format
  10. my printouts was using the shading feature to shade every
  11. other line.  Ted Dickens, Sysop of the HP Forum (76701,272)
  12. figured out the right way to accomplish this task.  The
  13. following is an edited version of several messages he wrote
  14. explaining how this is accomplished.  In addition, the
  15. sample program included in the LZRTPU.ZIP file
  16. (SHADETXT.PAS) was originally written by Ted to demonstrate
  17. this procedure.  I have modified it to take advantage of the
  18. LASERPRT.TPU functions.
  19.  
  20. ============================================================
  21. There are three different ways to position the cursor on a
  22. LaserJet+ (or later): row/col, dot/dot, and
  23. decipoint/decipoint.  The three are not interchangeable.
  24.  
  25. For the sake of this discussion, assume the top margin is 0
  26. lines and that the left unprintable margin is 0.25 inches.
  27.  
  28. The decipoint/decipoint control sequence, <esc>&a720v1440H,
  29. says move the cursor to 1" (720/720) from the top edge and
  30. 2.25" (1440/720 + 0.25" unprintable region) from the left
  31. edge.
  32.  
  33. The dot/dot control sequence, <esc>*p300y600X, does exactly
  34. the same thing.  With either command, the cursor will be
  35. positioned exactly 1" from the top of the paper and 2.25"
  36. from the left edge.  If you were to draw a single dot --
  37. that's where it would appear.
  38.  
  39. But, even though there are 10 characters per inch and 6 rows
  40. per inch, the row/col control sequence, <esc>&a6r20C, will
  41. NOT leave the cursor at the same position.
  42.  
  43. The cursor WILL be left 2.25" from the left edge.  But the
  44. vertical spacing will be at 6.75 rows from the top -- not 6
  45. as one might think.
  46.  
  47. There's a pretty good reason for this.  Think of a character
  48. cell:
  49.        +-------+
  50.        |       |
  51.        |       |
  52.        |       |  /______ Baseline is set to 75%
  53.        |       |  \       of the current VMI setting
  54.        +-------+
  55.  
  56. This little extra nudge moves the cursor so that the top of
  57. the character cell will fall at the specified location.  In
  58. this example -- the TOP of the first character we print
  59. should appear 1" from the top edge and 2.25" from the left
  60. edge.
  61.  
  62. In fact, the only time that the difference is even noticed
  63. is when mixing text and graphics.  (Shading is a graphic
  64. function on the LaserJets.)
  65.  
  66. Therefore, when shading a line of text, the shading
  67. procedure should:
  68.  
  69. 1. move the cursor up 75 percent of the height of the
  70.    current line height;
  71.  
  72. 2. fill the desired area;
  73.  
  74. 3. move the cursor down 75 percent of the height of the
  75.    current line height;
  76.  
  77. 4. print the line of text.
  78.  
  79. Thus, the up and down cursor movements are:
  80.  
  81.              Line Height       Movement
  82.    lpi       (decipoints)    (decipoints)
  83. ---------    ------------    ------------
  84.     4           180              135
  85.     6           120               90
  86.     8            90               67.5
  87.  
  88. (line height = (1 inch/X lpi)*(720 decipoints per inch)
  89. ============================================================
  90.  
  91. The principles discussed above are used in three sample
  92. programs.  The first (SHADETXT.PAS) is included in the
  93. LZRTPU.ZIP file.  The other two (SHADE1.PAS and SHADE2.PAS)
  94. are available in Library 0 of the HP forum.  SHADETXT.PAS is
  95. a sample program showing alternating lines of shaded text.
  96. SHADE1.PAS produces a pattern similar to "green bar" paper
  97. in the portrait format while SHADE2.PAS does the same thing
  98. except in the landscape format.
  99.  
  100. By the way, if you browse the HP library, you will see a
  101. SHADE3.PAS file.  That is the original version of the
  102. SHADETXT.PAS program.
  103.  
  104.  
  105.          ----------------end-of-author's-documentation---------------
  106.  
  107.                          Software Library Information:
  108.  
  109.                     This disk copy provided as a service of
  110.  
  111.                            Public (software) Library
  112.  
  113.          We are not the authors of this program, nor are we associated
  114.          with the author in any way other than as a distributor of the
  115.          program in accordance with the author's terms of distribution.
  116.  
  117.          Please direct shareware payments and specific questions about
  118.          this program to the author of the program, whose name appears
  119.          elsewhere in  this documentation. If you have trouble getting
  120.          in touch with the author,  we will do whatever we can to help
  121.          you with your questions. All programs have been tested and do
  122.          run.  To report problems,  please use the form that is in the
  123.          file PROBLEM.DOC on many of our disks or in other written for-
  124.          mat with screen printouts, if possible.  PsL cannot debug pro-
  125.          programs over the telephone, though we can answer questions.
  126.  
  127.          Disks in the PsL are updated  monthly,  so if you did not get
  128.          this disk directly from the PsL, you should be aware that the
  129.          files in this set may no longer be the current versions. Also,
  130.          if you got this disk from another vendor and are having prob-
  131.          lems,  be aware that  some files may have become corrupted or
  132.          lost by that vendor. Get a current, working disk from PsL.
  133.  
  134.          For a copy of the latest monthly software library newsletter
  135.          and a list of the 2,000+ disks in the library, call or write
  136.  
  137.                            Public (software) Library
  138.                                P.O.Box 35705 - F
  139.                             Houston, TX 77235-5705
  140.  
  141.                                  Orders only:
  142.                                 1-800-2424-PSL
  143.                               MC/Visa/AmEx/Discover
  144.  
  145.                           Outside of U.S. or in Texas
  146.                           or for general information,
  147.                               Call 1-713-524-6394
  148.  
  149.                           PsL also has an outstanding
  150.                           catalog for the Macintosh.
  151.  
  152.  
  153.